Range utility functions and column filter changes#1709
Conversation
✅ Deploy Preview for papaya-valkyrie-395400 canceled.
|
vuu-ui/packages/vuu-filters/src/column-filter/useColumnFilter.ts
Outdated
Show resolved
Hide resolved
| @@ -0,0 +1,116 @@ | |||
| import { describe, expect, it, vi } from "vitest"; | |||
There was a problem hiding this comment.
the vite tests live in vuu-utils/test/filters
| .map(([column, descriptor]) => { | ||
| const colDesc = this.#columns.get(column); | ||
| if (colDesc) | ||
| buildColumnFilterString( |
There was a problem hiding this comment.
you are not returning a value from the map function, so you build a list of undefined
There was a problem hiding this comment.
last minute change related to a type issue..causing the tests to fail!
| it("resets all filters", () => { | ||
| const store = new ColumnFilterStore(); | ||
| store.addFilter(toColumnDescriptor("ric"), "=", "AAOQ.OQ"); | ||
| store.addFilter(toColumnDescriptor("price"), ">", 100); |
There was a problem hiding this comment.
you are going to have to hard code the columnDescriptor here, it needs serverDataType: 'double'
otw it defaults to string and value will be quoted
There was a problem hiding this comment.
will we have columnDescriptor (serverDataType) when we are loading the store from a saved filter (query)?
There was a problem hiding this comment.
perhaps something we will have to maintain - a list of columnDescriptors used by the ColumnFilter on the page and inject it into the ColumnFilterStore constructor along with the query?
heswell
left a comment
There was a problem hiding this comment.
couple of minor things, which should fix the etsts
| const { serverDataType = "string" } = column; | ||
| const typedValue = Array.isArray(value) | ||
| ? value | ||
| : (getTypedValue(value, serverDataType, true) as ColumnFilterValue); //Check getTypedValue |
There was a problem hiding this comment.
to fix the type error, force this to a string... maybe
getTypedValue(`${value}`)
Updated examples to use ColumnFilterStore
Added test coverage Pls note: WIP - Looking at conversion of values - TimeColumnPicker/DatePicker examples may have issues because of this.
Added test coverage PR feedback implemented Todo Validation of range filters (numeric/date/time)
Allowing column descriptors to be injected through the column filter store class
a895870 to
a4540bb
Compare
Fixed failing test due to timezone
Changes to address circular dependency issue see
Updated examples to use ColumnFilterStore (not complete)